<template>
  <div style="width: 100%;" class="mt24">
    <t-form :data="formData" :rules="rules" ref="form" label-align="top">
      <t-form-item label="是否可租" name="is_rent">
        <t-switch v-model="formData.is_rent" :label="['允许', '禁止']" :custom-value="[1, 0]" />
      </t-form-item>
      <t-form-item v-if="formData.is_rent" label="日租价" name="day_rent">
        <t-input v-model="formData.day_rent" placeholder="请输入租赁价"></t-input>
      </t-form-item>
      <t-form-item label="租赁押金" name="cash_pledge">
        <t-input v-model="formData.cash_pledge" placeholder="请输入租赁押金"></t-input>
      </t-form-item>
      <!--<t-form-item label="序列号追朔" name="is_stock">-->
      <!--  <t-radio-group v-model="formData.is_stock" :options="stockOptions"></t-radio-group>-->
      <!--</t-form-item>-->
      <!--<t-form-item label="库存数量" name="stock_num">-->
      <!--  <t-input v-model="formData.stock_num" placeholder="请输入库存数量"></t-input>-->
      <!--</t-form-item>-->
    </t-form>
  </div>
</template>

<script>

export default {
  name: 'ProductLease',
  props: {
    value: {
      type: String,
      default: ''
    },
  },
  data() {
    return {
      editorOption: {},
      formData: {
        is_rent: 1, // 是否可租
        day_rent: '', // 日租价
        cash_pledge: '', // 租赁押金
        //is_selling: 1, // 是否可售
        //selling_price: '', // 售卖价
        //is_stock: 1,  // 库存模式
        //stock_num: '',  // 库存数量
      },
      rules: {
        //is_rent: [{required: true, message: '请选择是否可租', trigger: 'change'},],
        //day_rent: [{required: true, message: '请输入日租价', trigger: 'blur'},],
        //is_selling: [{required: true, message: '请选择是否可售卖', trigger: 'change'},],
        //selling_price: [{required: true, message: '请输入售卖价', trigger: 'blur'},],
        //cash_pledge: [{required: true, message: '请输入租赁押金', trigger: 'blur'},],
        //is_stock: [{required: true, message: '请选择库存模式', trigger: 'change'},],
        //stock_num: [{required: true, message: '请输入库存数量', trigger: 'blur'},],
      },
      stockOptions: [
        //0 无库存；1 库存模式；2 库存数量模式）
        {label: '无库存', value: 0},
        {label: '库存模式', value: 1},
        {label: '库存数量模式', value: 2},
      ]
    }
  },
  mounted() {
  },
  methods: {
    reset() {
      this.formData = {
        is_rent: 1, // 是否可租
        day_rent: '', // 日租价
        cash_pledge: '', // 租赁押金
        //is_selling: 1, // 是否可售
        //selling_price: '', // 售卖价
        //is_stock: 1,  // 库存模式
        //stock_num: '',  // 库存数量
      }
      this.$refs.form.reset()
    },
    submit() {
      return  this.$refs.form.validate()
    },
    changeSwitch(value) {
      console.log('value', value)
    }
  }
}
</script>

<style lang="less" scoped>

</style>
